fix(h265): add bounds safety in mpeg4 codec parsing and remove dead code#2191
Open
MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
Open
fix(h265): add bounds safety in mpeg4 codec parsing and remove dead code#2191MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
Conversation
DecodeConfig: add a minimum 28-byte length check before accessing conf[1:4] and conf[23:], plus per-section length guards before slicing each VPS/SPS/PPS region — a truncated HEVCDecoderConfigurationRecord previously caused an index-out-of-range panic. EncodeConfig: return nil early when vps/pps are empty or sps is shorter than 6 bytes; the existing code copied sps[3:6] unconditionally. rtp.go RTPDepay: remove the dead check `if nuStart > len(buf)+4`. nuStart is assigned from len(buf) before appending, so after at least 6 bytes are appended the condition is structurally always false and the buf[:0] reset that followed it never fired. The size field is written correctly by the PutUint32 on the next line regardless.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DecodeConfig: add a minimum 28-byte length check before accessingconf[1:4]andconf[23:], plus per-section length guards before slicing each VPS/SPS/PPS region — a truncated HEVCDecoderConfigurationRecord previously caused an index-out-of-range panic.EncodeConfig: return nil early when vps/pps are empty or sps is shorter than 6 bytes; the existing code copiedsps[3:6]unconditionally.RTPDepay: remove the dead checkif nuStart > len(buf)+4. nuStart is assigned fromlen(buf)before appending, so after at least 6 bytes are appended the condition is always false and thebuf[:0]reset never fired.